<?php

namespace app\admin\controller;

use app\common\model\Manager as ManagerModel;
use app\common\model\ManagerCompany as ManagerCompanyModel;
use app\common\model\ManagerPassword as ManagerPasswordModel;
use app\common\model\Member as MemberModel;

/**
 * 法师控制器
 * Class Manager
 * @package app\index\controller
 */
class Manager extends Base
{
    /**
     * [del  法师删除]
     * @param
     * @return mixed|\think\response\Json
     * @author [C。]
     */
    public function del()
    {
        $param = input('param.');
        $model = new ManagerModel;
        $mmodel = new MemberModel;
        $mcmodel = new ManagerCompanyModel;
        $mpmodel = new ManagerPasswordModel;
        try{
            $manager = $model->findOne(['tel'=>$param['tel']],'id');
            $mmodel->deleteFalseData(['tel'=>$param['tel']],['identity'=>1]);
            $model->deleteFalseData(['tel'=>$param['tel']],['states'=>3]);
            $mcmodel->deleteFalseData(['mid'=>$manager['id']],['status'=>-1]);
            $mpmodel->deleteFalseData(['mid'=>$manager['id']],['states'=>-1]);
        } catch (\Exception $e) {
            return admin_json(-1,$e->getMessage());
        }
        return admin_json(1,'删除成功');
    }
}